//
//  TNMemberTeamViewController.m
//  跑跑快销
//
//  Created by ylife on 14-5-7.
//  Copyright (c) 2014年 ylife. All rights reserved.
//

#import "TNMemberTeamViewController.h"
#import "TNTeamCollectionViewCell.h"
#import "TNMenberDetailViewController.h"

@interface TNMemberTeamViewController ()

@end

@implementation TNMemberTeamViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    _teamView = [[YXTeamView alloc]init];
    [_teamView setItemsViewHeight:0];
    [_teamView setTabbarHeight:0];
    [_teamView createRelationshipView];
    self.view = _teamView;
    _teamView.collectionView.dataSource = self;
    _teamView.collectionView.delegate = self;
    
    //设置团长名字和图片
    [_teamView.myButton setTitle:@"团长" forState:UIControlStateNormal];
    [_teamView.myButton setImage:[UIImage imageNamed:@"a.png"] forState:UIControlStateNormal];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{

    return 17;
    
}

-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *identifier = @"cell";
    NSLog(@"section:%d , row:%d ",indexPath.section,indexPath.row);
    TNTeamCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];
    if (!cell) {
        cell = [[TNTeamCollectionViewCell alloc]init];
    }
    //    cell.contentView.backgroundColor = [UIColor blueColor];
    //    cell.name = array[indexPath.section];
    //    cell.imageView.image = [UIImage imageNamed:@"a.png"];
    cell.button.backgroundColor = [UIColor redColor];
    //    cell.button.imageView.backgroundColor = [UIColor whiteColor];
    //    cell.button.imageView.image = [UIImage imageNamed:@"a.png"];
    [cell.button setImage:[UIImage imageNamed:@"a.png"] forState:UIControlStateNormal];
    
    [cell.button setTitle:@"团员" forState:UIControlStateNormal];
    [cell.button addTarget:self action:@selector(gotoTNMemberTeamViewController) forControlEvents:UIControlEventTouchUpInside];
    //    cell.button.titleLabel.text = array[indexPath.section];
    
    return cell;
    
}

- (void)gotoTNMemberTeamViewController
{
    [self setHidesBottomBarWhenPushed:YES];
    TNMenberDetailViewController *viewController = [[TNMenberDetailViewController alloc]init];
    [self.navigationController pushViewController:viewController animated:YES];
}

@end
